package com.highspeed.bdk.gateway.socket.analyze.message.gui.resolver;

import com.highspeed.bdk.gateway.Util;
import com.highspeed.bdk.gateway.socket.analyze.message.gui.base.MessageResolver;

import java.util.Map;

/**
 * 3.14所有逻辑链的物理链路查询的反馈数据包
 * typedef struct _phyLinksonallLogicLinks
 * {
 * U32 linkNum;//逻辑链路的数 量
 * PhyUnderLogicLinkData links[0];
 * } PhyLinksONAllLksFbData;
 */
public class PhyLinksonallLogicLinksResolver extends MessageResolver {

    @Override
    protected Map doResolveBody(byte[] response) {
        int linkNum = Util.getInt(response, getOffset());
        offset4();
        logger.info("linNum............." + linkNum);

        //逻辑链路对应物理链路查询的反馈包
        PhyUnderLogicLinkResolver0x0F phyUnderLogicLinkResolver = new PhyUnderLogicLinkResolver0x0F();
        phyUnderLogicLinkResolver.setContainer(getContainer());
        for (int i = 0; i < linkNum; i++) {
            logger.info("解析第" + i + "个逻辑链路对应物理链路查询的反馈包..........");
            phyUnderLogicLinkResolver.doResolveBody(response);
        }
        return getContainer();
    }
}
